<!doctype html>
<html lang="en">
<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <title>实名认证 - 期金管家</title>
    <!-- Bootstrap CSS -->
<!--    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css"
          integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous">

    <link rel="stylesheet" href="/static/home/css/common.css">-->
    <link rel="stylesheet" href="/static/admin/select/viewer.css">


</head>
<body>
<script type="text/javascript" src="http://www.lcqjgj.com/static/home/js/jquery-3.3.1.min.js"></script>
<script src="/static/ysimage/megapix-image.js"></script>
<script src="/static/ysimage/megapix-image.test.js"></script>

<!--HEADER-->
{include file="Public/header"/}
<!--HEADER-->

<div class="container verified">
    <div class="row">
        {include file="Public/readme"/}
        <div class="col-md-9">
            <ul class="nav nav-tabs mb-4" role="tablist">
                <li class="nav-item">
                    <a class="nav-link bg-dark text-white active" href="#home" role="tab" data-toggle="tab">实名认证</a>
                </li>
            </ul>
            <div class="tab-content row">
                <div class="col-md-4 text-center d-none d-sm-block">
                    <img src="/static/home/images/imgHead.jpg" />
                </div>

                {if condition="$user.RNA==0"}
                <form id="myform" method="post" class="form-horizontal col-md-8" action="/home/certification/addSubmit" novalidate="novalidate" enctype="multipart/form-data">
                    <div class="form-group row mb-3">
                        <label class="col-md-3 control-label" for="infoUserName">&nbsp;&nbsp;姓名：</label>
                        <div class="col-md-9">
                            <input type="text" class="form-control" id="infoUserName" name="infoUserName" aria-required="true" aria-describedby="firstname1-error" aria-invalid="true" value="">
                            <span class="glyphicon glyphicon-remove form-control-feedback" id="xm"></span>
                        </div>
                    </div>
                    <div class="form-group row mb-3">
                        <label class="col-md-3 control-label" for="infoUserCard">&nbsp;&nbsp;身份证：</label>
                        <div class="col-md-9">
                            <input type="text" class="form-control" id="infoUserCard" name="infoUserCard" aria-required="true" aria-describedby="firstname1-error" aria-invalid="true" value="">
                            <span class="glyphicon glyphicon-remove form-control-feedback" id='sf'></span>
                        </div>
                    </div>
                    <input type="hidden" name="codes" value="{:session('codes')}">
                    <div class="form-group row mb-3">
                        <label class="col-md-3 control-label" for="infoUserCard01">&nbsp;&nbsp;身份证正面：</label>
                        <div class="custom-file col-md-9" style="height:initial;">
                            <!--<input type="file" name="img" class="" id="infoUserCard01" accept="image/*">-->
                            <input type="file" id="cardFileInput1" accept="image/*">
                            <br/>
                            <div>身份证正面预览:</div>
                            <div><img id="cardResultImage1" class="float-left" style="max-width:240px;max-height:150px;"></div>
                            <input id='cardImagestr1' type="hidden" name="cardImagestr1">

                        </div>

                    </div>
                    <div class="form-group row mb-3">
                        <label class="col-md-3 control-label" for="infoUserCard02">&nbsp;&nbsp;身份证反面：</label>
                        <div class="custom-file col-md-9" style="height:initial;">
                            <!--<input type="file" name="img2" class="" id="infoUserCard02" accept="image/*">-->
                            <input type="file" id="cardFileInput2" accept="image/*">
                            <br/>
                            <div>身份证反面预览:</div>
                            <div><img id="cardResultImage2" class="float-left" style="max-width:240px;max-height:150px;"></div>
                            <input id='cardImagestr2' type="hidden" name="cardImagestr2">
                        </div>
                        <!--<div class="input-group-append">-->
                        <!--<span class="input-group-text">Upload</span>-->
                        <!--</div>-->
                    </div>

                    <div class="form-group row">
                        <div class="col">
                            <button type="submit" class="btn btn-success btn-block" name="signup1" onclick="btnCardImg()" value="去认证">去认证</button>
                        </div>
                    </div>
                    <p class="text-danger mb-3">
                        注：1.如长时间没有反应，请检查网络并<a href="javascript:history.go(0);" style="color: blue;">刷新</a>页面。<br />
                        　　2.微信内登录可能导致上传图片失败，请点击微信右上角，选择浏览器打开网站登录后上传实名认证照片。
                    </p>
                </form>
                {elseif condition = "$user.RNA == 2" \}
                <form id="setinfoForm" method="post" class="form-horizontal col-md-8"  novalidate="novalidate">
                    <div class="form-group row mb-3">
                        <label class="col-md-3 control-label" for="infoUserName">&nbsp;&nbsp;姓名：</label>
                        <div class="col-md-9">
                            <input type="text" class="form-control" id="infoUserName" name="infoUserName" aria-required="true" aria-describedby="firstname1-error" aria-invalid="true" value="{$cer.name}" disabled>
                            <span class="glyphicon glyphicon-remove form-control-feedback" ></span>
                        </div>
                    </div>
                    <div class="form-group row mb-3">
                        <label class="col-md-3 control-label" for="infoUserCard">&nbsp;&nbsp;身份证：</label>
                        <div class="col-md-9">
                            <input type="text" class="form-control" id="infoUserCard" name="infoUserCard" aria-required="true" aria-describedby="firstname1-error" aria-invalid="true" value="{$cer.IDnumber}" disabled>
                            <span class="glyphicon glyphicon-remove form-control-feedback"></span>
                        </div>
                    </div>

                    <div class="form-group row">
                        <div class="col">
                            <button type="" class="btn btn-danger btn-block" value="去认证" disabled>认证中</button>
                        </div>
                    </div>
                    <p class="text-danger mb-3">注：资料已经提交，请等待...<a href="javascript:history.go(0);" style="color: blue;">刷新</a>页面。</p>
                </form>
                {elseif condition = "$user.RNA == 3" \}
                    <form id="setinfoForm" method="post" class="form-horizontal col-md-8"  novalidate="novalidate">
                        <div class="form-group row mb-3">
                            <label class="col-md-3 control-label" for="infoUserName">&nbsp;&nbsp;姓名：</label>
                            <div class="col-md-9">
                                <input type="text" class="form-control" id="infoUserName" name="infoUserName" aria-required="true" aria-describedby="firstname1-error" aria-invalid="true" value="{$cer.name}" disabled>
                                <span class="glyphicon glyphicon-remove form-control-feedback" ></span>
                            </div>
                        </div>
                        <div class="form-group row mb-3">
                            <label class="col-md-3 control-label" for="infoUserCard">&nbsp;&nbsp;身份证：</label>
                            <div class="col-md-9">
                                <input type="text" class="form-control" id="infoUserCard" name="infoUserCard" aria-required="true" aria-describedby="firstname1-error" aria-invalid="true" value="{$cer.IDnumber}" disabled>
                                <span class="glyphicon glyphicon-remove form-control-feedback"></span>
                            </div>
                        </div>
                        <div class="form-group row mb-3">
                            <label class="col-md-3 control-label" for="infoUserCard">&nbsp;&nbsp;照片一：</label>
                            <div class="col-md-9">
                                <img src="/upload/certification/{$cer.IDpositive}"  height="100" width="150"  alt="">
                            </div>
                        </div>
                        <div class="form-group row mb-3">
                            <label class="col-md-3 control-label" for="infoUserCard">&nbsp;&nbsp;照片二：</label>
                            <div class="col-md-9">
                                <img src="/upload/certification/{$cer.IDback}"  height="100" width="150" alt="">

                            </div>
                        </div>
                        <div class="form-group row mb-3">
                            <label class="col-md-3 control-label" for="infoUserCard">&nbsp;认证未通过原因：</label>
                            <div class="col-md-9">
                                <input type="text" class="form-control" id="infoUserCard" name="infoUserCard" aria-required="true" aria-describedby="firstname1-error" aria-invalid="true" value="{$cer.remark}" disabled>
                                <span class="glyphicon glyphicon-remove form-control-feedback"></span>
                            </div>
                        </div>

                        <div class="form-group row">
                            <div class="col">
                                <button type="" class="btn btn-danger btn-block" value="重新认证" id="refresh">重新认证</button>
                            </div>
                        </div>
                        <b></b>
                        <p class="mb-3">注：您的实名认证未通过，请阅读<b style="" class="text-danger">未通过原因</b>修正后再上传。<a href="javascript:history.go(0);" class="text-danger">刷新</a>页面。</p>
                    </form>
                {elseif condition = "$user.RNA == 1"\}

                <form id="setinfoForm" class="form-horizontal col-md-8"  novalidate="novalidate">
                    <h4 class="mb-4">已实名认证</h4>
                    <div class="form-group row mb-3">
                        <label class="col-md-3 control-label" for="infoUserName">&nbsp;&nbsp;姓名：</label>
                        <div class="col-md-9">
                            <input type="text" class="form-control" id="" name="infoUserName" aria-required="true" aria-describedby="firstname1-error" aria-invalid="true" value="{$user.name}" disabled>
                            <span class="glyphicon glyphicon-remove form-control-feedback" ></span>
                        </div>
                    </div>
                    <div class="form-group row mb-3">
                        <label class="col-md-3 control-label" for="infoUserName">&nbsp;&nbsp;身份证：</label>
                        <div class="col-md-9">
                            <input type="text" class="form-control"  name="infoUserName" aria-required="true" aria-describedby="firstname1-error" aria-invalid="true" value="{:substr_replace($cer.IDnumber,'********',4,8)}" disabled>
                            <span class="glyphicon glyphicon-remove form-control-feedback" ></span>
                        </div>
                    </div>
                </form>
                {/if}


            </div>
        </div>

    </div>
</div>
<br /><br /><br /><br /><br />
<script src="/static/admin/select/viewer.js"></script>
<!--footer-->
{include file="Public/footer"/}
<script type="text/javascript">
    function btnCardImg(){
        $('#cardImagestr1').val($('#cardResultImage1').attr('src'));
        $('#cardImagestr2').val($('#cardResultImage2').attr('src'));
        $('#myform').submit();

    }
</script>
<script>
flags = false;flag=false;
    pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~！@#￥……&*（）——|{}【】‘；：”“'。，、？《》]  ");
    $("#infoUserName").focus(function(){
        $("#xm").html('');
    }).blur(function(){
        var infoUserName = $("#infoUserName").val();
         if(pattern.test(infoUserName)){
            $("#xm").html('不能使用特殊字符').css('color','red');
            flags = false;
         }else{
            flags = true;
         }
    });
    // var infoUserCard = $("#infoUserCard").val();
    $("#infoUserCard").focus(function(){
        $("#sf").html(' ');
    }).blur(function(){
        var infoUserCard = $("#infoUserCard").val();
        if(pattern.test(infoUserCard)){
             $("#sf").html('不能使用特殊字符').css('color','red');
             flag = false;
        }else{
            // alert(123)
            $.ajax({
                url:"/home/certification/idVerification",
                type:"POST",
                data:{
                    infoUserCard:infoUserCard
                },
                success : function(data){
                    if(data['msg']=='error'){
                        $("#sf").html('该身份证已经被注册').css('color','red');
                        flag = false;
                    }else{
                        flag = true;
                    }
                }
            })
        }

    });


    $("form").submit(function(){
        if (!flag||!flags){
            return false;
        }else{
            return true;
        }   
    });
    //图片预览
    var viewer = new Viewer(document.getElementById('setinfoForm'), {
        url: 'data-original'
    });

</script>

<script>

    $(function(){
        $("#refresh").click(function(){
            if(confirm("确认重新验证？")) {
                $.ajax({
                    url: '/home/Certification/refreshCer',
                    type: "POST",
                    data: {
                        refresh: 'refresh',
                    },
                    success: function (data) {
                        if (data['msg'] == 'success') {
                            window.location.reload();
                        } else {
                            alert(data['msg']);
                            window.location.reload();
                        }
                    }
                });
            }
        })
    })

</script>





